package edu.metrostate.capstonediner;

import android.util.Log;
import android.view.*;
import android.view.View.OnTouchListener;

public class GameInput implements OnTouchListener {
	private float x;
	private float y;
	private float xscale;
	private float yscale;
	private int touchTally;
	private View view;
	
	public GameInput(View view, int width, int height) {
		this.view = view;
		xscale = Constants.SCREEN_WIDTH / width;
		yscale = Constants.SCREEN_HEIGHT / height;
		x = 16f;
		y = (Constants.SCREEN_HEIGHT / 2f);
	}
	
	public float getX() {
		return x;
	}
	
	public float getY() {
		return y;
	}
	
	public int getTouchTally() {
		return touchTally;
	}
	
	public boolean onTouch(View view, MotionEvent event){
		x = xscale * event.getX();
		y = yscale * event.getY();
		if(event.getAction() == MotionEvent.ACTION_DOWN) touchTally++;
		return true;
	}
}
